/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_listedepartement")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvListedepartement.findAll", query = "SELECT c FROM CvListedepartement c"),
    @NamedQuery(name = "CvListedepartement.findByIddepartement", query = "SELECT c FROM CvListedepartement c WHERE c.iddepartement = :iddepartement"),
    @NamedQuery(name = "CvListedepartement.findByNomdepartement", query = "SELECT c FROM CvListedepartement c WHERE c.nomdepartement = :nomdepartement")})
public class CvListedepartement implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "iddepartement")
    private String iddepartement;
    @Column(name = "nomdepartement")
    private String nomdepartement;
    @OneToMany(mappedBy = "iddepartement", fetch = FetchType.LAZY)
    private List<CvEquipedepartement> cvEquipedepartementList;
    @JoinColumn(name = "idmission", referencedColumnName = "idmission")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private CvMission idmission;

    public CvListedepartement() {
    }

    public CvListedepartement(String iddepartement) {
        this.iddepartement = iddepartement;
    }

    public String getIddepartement() {
        return iddepartement;
    }

    public void setIddepartement(String iddepartement) {
        this.iddepartement = iddepartement;
    }

    public String getNomdepartement() {
        return nomdepartement;
    }

    public void setNomdepartement(String nomdepartement) {
        this.nomdepartement = nomdepartement;
    }

    @XmlTransient
    @JsonIgnore
    public List<CvEquipedepartement> getCvEquipedepartementList() {
        return cvEquipedepartementList;
    }

    public void setCvEquipedepartementList(List<CvEquipedepartement> cvEquipedepartementList) {
        this.cvEquipedepartementList = cvEquipedepartementList;
    }

    public CvMission getIdmission() {
        return idmission;
    }

    public void setIdmission(CvMission idmission) {
        this.idmission = idmission;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iddepartement != null ? iddepartement.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvListedepartement)) {
            return false;
        }
        CvListedepartement other = (CvListedepartement) object;
        if ((this.iddepartement == null && other.iddepartement != null) || (this.iddepartement != null && !this.iddepartement.equals(other.iddepartement))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvListedepartement[ iddepartement=" + iddepartement + " ]";
    }
    
}
